//
//  CollectionNormalCell.swift
//  1106-douyu
//
//  Created by targetcloud on 2016/11/7.
//  Copyright © 2016年 targetcloud. All rights reserved.
//

import UIKit
import SnapKit

class CollectionNormalCell: UICollectionViewCell {
    
    var name = UILabel()
    var img  = UIImageView()
    var sex  = UIImageView()
    var age  =  UILabel()
    var phone = UILabel()
    var start  = UILabel()
    var persist  = UILabel()
    var sxCount  =  UILabel()
    var ssCount  =  UILabel()
    var otherCount  =  UILabel()
    var warningCount  =  UILabel()
    var level  =  UILabel()
    var line1 = UIView()
    var line2 = UIView()
    var line3 = UIView()
    
    
    

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.red
        self.addSubview(img)
        img.image = UIImage.init(named: "one")
        img.backgroundColor = UIColor.orange
        img.snp.makeConstraints { (make) -> Void in
            make.width.height.equalTo(50)
            make.left.equalTo(15)
            make.top.equalTo(15)
        }
        img.layer.cornerRadius = 25;

        self.addSubview(name)
        name.text = "柳飘飘"
        name.textColor = UIColor.black
        name.font = UIFont.boldSystemFont(ofSize: 12)
        name.textAlignment = NSTextAlignment.left
        name.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(20)
            make.left.equalTo(img.snp.right).offset(10)
            make.width.equalTo(40)
            make.height.equalTo(20)
        }
        
        self.addSubview(sex)
        sex.backgroundColor = UIColor.yellow
        sex.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(name)
            make.left.equalTo(name.snp.right).offset(10)
            make.width.equalTo(20)
            make.height.equalTo(20)
        }
        
        self.addSubview(age)
        age.text = "年龄：200"
        age.textColor = UIColor.black
        age.font = UIFont.boldSystemFont(ofSize: 12)
        age.textAlignment = NSTextAlignment.left
        age.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(name.snp.bottom)
            make.left.equalTo(name)
            make.width.equalTo(70)
            make.height.equalTo(20)
        }
        
        self.addSubview(phone)
        phone.text = "电话：18888888888"
        phone.textColor = UIColor.black
        phone.font = UIFont.boldSystemFont(ofSize: 12)
        phone.textAlignment = NSTextAlignment.left
        phone.snp.makeConstraints { (make) -> Void in
            make.centerY.equalTo(age)
            make.left.equalTo(age.snp.right).offset(10)
            make.right.equalTo(self)
            make.height.equalTo(20)
        }
        
        self.addSubview(line1)
        line1.backgroundColor = UIColor.lightGray
        line1.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(img.snp.bottom).offset(15)
            make.left.equalTo(self)
            make.right.equalTo(self)
            make.height.equalTo(1)
        }
        
        self.addSubview(start)
        start.text = "开始时间：02-55 20:33"
        start.textColor = UIColor.black
        start.textAlignment = NSTextAlignment.center
        start.font = UIFont.boldSystemFont(ofSize: 12)
        start.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(line1.snp.bottom).offset(15)
            make.left.equalTo(self)
            make.right.equalTo(self.snp.centerX).offset(0)
            make.height.equalTo(20)
        }
        
        self.addSubview(persist)
        persist.text = "持续时间：02-55 20:33"
        persist.textColor = UIColor.black
        persist.textAlignment = NSTextAlignment.center
        persist.font = UIFont.boldSystemFont(ofSize: 12)
        persist.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(line1.snp.bottom).offset(15)
            make.left.equalTo(self.snp.centerX).offset(0)
            make.height.equalTo(20)
            make.right.equalTo(self)
        }
        
        self.addSubview(line2)
        line2.backgroundColor = UIColor.lightGray
        line2.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(start.snp.bottom).offset(15)
            make.left.equalTo(self)
            make.right.equalTo(self)
            make.height.equalTo(1)
        }
        
        self.addSubview(sxCount)
        sxCount.text = "室性事件数量：2000"
        sxCount.textColor = UIColor.black
        sxCount.textAlignment = NSTextAlignment.center
        sxCount.font = UIFont.boldSystemFont(ofSize: 12)
        sxCount.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(line2.snp.bottom).offset(8)
            make.right.equalTo(self.snp.centerX).offset(0)
            make.height.equalTo(20)
            make.left.equalTo(self)
        }
        
        self.addSubview(ssCount)
        ssCount.text = "室上性事件数量：2000"
        ssCount.textColor = UIColor.black
        ssCount.textAlignment = NSTextAlignment.center
        ssCount.font = UIFont.boldSystemFont(ofSize: 12)
        ssCount.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(line2.snp.bottom).offset(8)
            make.left.equalTo(self.snp.centerX).offset(0)
            make.height.equalTo(20)
            make.right.equalTo(self)
        }
        
        self.addSubview(otherCount)
        otherCount.text = "其它事件数量：2000"
        otherCount.textColor = UIColor.black
        otherCount.textAlignment = NSTextAlignment.center
        otherCount.font = UIFont.boldSystemFont(ofSize: 12)
        otherCount.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(sxCount.snp.bottom).offset(8)
            make.right.equalTo(self.snp.centerX).offset(0)
            make.height.equalTo(20)
            make.left.equalTo(self)
        }
        
        self.addSubview(line3)
        line3.backgroundColor = UIColor.lightGray
        line3.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(otherCount.snp.bottom).offset(8)
            make.left.equalTo(self)
            make.right.equalTo(self)
            make.height.equalTo(1)
        }
        
        self.addSubview(warningCount)
        warningCount.text = "告警数量：9999       告警水位线：心动过速度2级  心动过缓2级"
        warningCount.textColor = UIColor.black
        warningCount.numberOfLines = 0;
        warningCount.textAlignment = NSTextAlignment.left
        warningCount.font = UIFont.boldSystemFont(ofSize: 12)
        warningCount.snp.makeConstraints { (make) -> Void in
            make.top.equalTo(line3.snp.bottom).offset(8)
            make.right.equalTo(-12)
            make.bottom.equalTo(-8)
            make.left.equalTo(12)
        }
        
        
        
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

